const live2d_path = "./kbn/";
function loadExternalResource(url, type) {
    return new Promise((resolve,reject)=>{
        let tag;
        if (type === "css") {
            tag = document.createElement("link");
            tag.rel = "stylesheet";
            tag.href = url;
        } else if (type === "js") {
            tag = document.createElement("script");
            tag.src = url;
        }
        if (tag) {
            tag.onload = ()=>resolve(url);
            tag.onerror = ()=>reject(url);
            document.head.appendChild(tag);
        }
    }
    );
}
Promise.all([loadExternalResource(live2d_path + "waifu1.css", "css"), loadExternalResource(live2d_path + "live2d.min.js", "js"), loadExternalResource(live2d_path + "waifu-tips.js", "js")]).then(()=>{
    initWidget({
        waifuPath: live2d_path + "waifu-tips.json",
        cdnPath: "https://cdn.jsdelivr.net/gh/starlighteternal/live2d_api/"
    });
}
);